package com.xxzb.pack0722.组装.service;


import com.xxzb.bean.Dept;
import com.xxzb.bean.Emp;
import com.xxzb.pack0722.组装.dao.DeptDAO;
import com.xxzb.pack0722.组装.dao.EmpDAO;

import java.util.List;

public class DeptService {
    private EmpDAO edao;
    private DeptDAO ddao;

    public DeptService() {
        edao=new EmpDAO();
        ddao=new DeptDAO();
    }
    public List<Dept> find() throws Exception {
        List<Dept> list=ddao.find();
        for (int i = 0; i < list.size(); i++) {
            Dept dept=list.get(i);
            List<Emp> list1=edao.findByDeptNo(dept.getDeptNo());
            dept.setEmps(list1);
        }
        return list;

    }
}
